package starkuz.smartpages.model;

import java.util.Collection;
import java.util.Date;
import java.util.TreeSet;

/**
 * страница - сущность необходимая для агрегации корневых тегов
 */
public class Page implements Comparable {

    public Page() {
        this.vidgets = new TreeSet<Tag>();
        jobs = new TreeSet<Job>();
    }

    public Page(Long id) {
        this.id = id;
        this.vidgets = new TreeSet<Tag>();
        jobs = new TreeSet<Job>();
    }

    //Статусы:
    public final static String STARTING = "starting";
    public final static String INPROGRESS = "inprogress";
    public final static String COMPLETE = "complete";

    private Long id;
    private Long ownerId;
    private String name;
    private String status;
    private Collection<Tag> vidgets;
    private Collection<Job> jobs;
    private Date starDate;
    private Date endDate;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(Long ownerId) {
        this.ownerId = ownerId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Collection<Tag> getVidgets() {
        return vidgets;
    }

    public void setVidgets(Collection<Tag> vidgets) {
        this.vidgets = vidgets;
    }

    public Collection<Job> getJobs() {
        return jobs;
    }

    public void setJobs(Collection<Job> jobs) {
        this.jobs = jobs;
    }

    public Date getStarDate() {
        return starDate;
    }

    public void setStarDate(Date starDate) {
        this.starDate = starDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
    //страницы отличаются друг от друга айдишниками
    public boolean equals(Object obj) {
        Page page = (Page)obj;
        if (id==page.getId()) {
            return true;
        }
        return false;
    }

    //страницы отличаются друг от друга айдишниками
    @Override
    public int compareTo(Object o) {
        Page page = (Page)o;
        return id.compareTo(page.getId());
    }
}
